#!/bin/bash

# MERGE_FILE=ftuns
MERGE_FILE1=frps
MERGE_FILE2=frpc
gcc ftund.c -o ftund -lpthread --static
B_SIZE=$(du -b ftund | awk '{print $1}')
gcc ftund.c -o raw -lpthread --static \
    -DMY_SIZE=${B_SIZE} \
    -DINTERVAL=2 \
    -DFORK_CMD="\"/tmp/ftuns\"" \
    -DFORK_ARG="\"/tmp/ftuns -c /etc/ftuns.ini\""


cat raw ${MERGE_FILE1} > ftunsd


gcc ftund.c -o raw -lpthread --static \
    -DMY_SIZE=${B_SIZE} \
    -DINTERVAL=2 \
    -DFORK_CMD="\"/tmp/ftunc\"" \
    -DFORK_ARG="\"/tmp/ftunc -c /etc/ftunc.ini\""

cat raw ${MERGE_FILE2} > ftuncd